


***********************************************
****** The Impact of Soft-Skills Training *****
******    for Entrepreneurs in Jamaica    *****
***********************************************


* This file cleans the data coming from the two questionnaires for the baseline (one on Qualtrics and one on SurveyMonkey)


clear all
cap log close
set more off

cap cd "$directory"



************************
*** Qualtrics Survey ***
************************

*** Load data ***

* Load data
use "$data_raw/bas_data_qualtrics", clear

* Label respondent_id
lab var respondent_id "Respondent ID"


*** Edit data ***

* Correct self-employment var for respondents who misinterpreted the question and reported profits and/or sales
replace q6="1" if respondent_id==20140
replace q6="1" if respondent_id==20378
replace q6="1" if respondent_id==20387

* Correct number of employees
replace q14_2_text=subinstr(q14_2_text, "hrs","", 1)

* Correct working days
replace q16_1_text="4" if q16_1_text=="03-mag" 
replace q16_1_text="6" if q16_1_text=="5/7" | q16_1_text=="5-7"
replace q16_1_text="4" if q16_1_text=="3-5"
replace q16_1_text="6" if q16_1_text=="6 days a week"
replace q16_1_text="6" if q16_1_text=="6 (8 hours per day)"
replace q16_1_text=subinstr(q16_1_text,"days","",1) 
replace q16_1_text="" if inlist(q16_1_text,"0-7","every other week","N/A")
replace q16_1_text=subinstr(q16_1_text,"when in operation","",1)
destring q16_1_text, gen(temp)
replace q16_1_text="" if temp>7
drop temp

* Correct working hours
replace q16_2_text=subinstr(q16_2_text,"hours","",1)
replace q16_2_text=subinstr(q16_2_text,"hrs","",1)
replace q16_2_text="10" if q16_2_text=="08-dic" 
replace q16_2_text="12.5" if q16_2_text=="10-15" 
replace q16_2_text="9" if q16_2_text=="8-10" 
replace q16_2_text="10" if q16_2_text=="8-12" 
replace q16_2_text="9" if q16_2_text=="9am - 6pm"
replace q16_2_text="" if q16_2_text=="gen-24"
replace q16_2_text="" if q16_2_text=="1-24"
replace q16_2_text="" if q16_2_text=="0 - 24" | q16_2_text=="N/A" 
replace q16_2_text="13.5" if q16_2_text=="12-15"
replace q16_2_text="4" if q16_2_text=="24  or 4 hours"
replace q16_2_text="8" if q16_2_text=="4 - 12" | q16_2_text=="4-12"
replace q16_2_text="6" if q16_2_text=="4-8"
replace q16_2_text="7.5" if q16_2_text=="7 1/2" | q16_2_text=="7-8" 
replace q16_2_text="8.5" if q16_2_text=="8-9" 
replace q16_2_text="9.5" if q16_2_text=="9 1/2"
destring q16_2_text, gen(temp)
replace q16_2_text="" if temp>24
drop temp

* Correct sales, costs and profits
foreach var of varlist q21_1_text q21_2_text q22_1_text q22_2_text q23_1_text q23_2_text {
	replace `var'=subinstr(`var',"$","",2)
	replace `var'=subinstr(`var',",","",2)
	replace `var'=subinstr(`var',"about","",1)
	replace `var'=subinstr(`var',"Average","",1)
	replace `var'=subinstr(`var',"N/A","0",1)
	replace `var'=subinstr(`var',"n/a","0",1)
	replace `var'=subinstr(`var',".00","",1)
	replace `var'="45000" if `var'=="40000-50000"
	replace `var'="75000" if `var'=="70000-80000"
	replace `var'="0" if `var'=="None" | `var'=="no income" | `var'=="Break even"
	replace `var'="27500" if `var'=="25000-30000"
	replace `var'="25000" if `var'=="20000-30000"
	replace `var'="37500" if `var'=="30000-45000"
	replace `var'="1500000" if `var'=="1.5 million"
	replace `var'="1300000" if `var'=="1.3 million"
	replace `var'="150000" if `var'=="140000-160000"
	replace `var'="200000" if `var'==" 200.000"
	replace `var'="25000" if `var'=="20000- 30000"
	replace `var'="225000" if `var'=="200000-250000"
	replace `var'="153000" if `var'=="146000-160000"
	replace `var'="8333" if `var'=="25000 for 3 months"
}

* Correct sales in the last month
replace q21_1_text="0" if q21_1_text=="N/a"
replace q21_1_text="" if respondent_id==20058

* Correct sales in a typical month
replace q21_2_text="200000" if q21_2_text=="200.000.00"
replace q21_2_text="60000" if q21_2_text=="$60, 000 in seasonal time"
replace q21_2_text="0" if q21_1_text=="0" & q21_2_text==""
replace q21_2_text="300000" if respondent_id==20094
replace q21_2_text="360000" if respondent_id==20821

* Correct costs in the last month
replace q22_1_text="0" if q22_1_text=="two small to mention"
replace q22_1_text="" if respondent_id==20174

* Correct costs in a typical month
replace q22_2_text="350000" if q22_2_text=="$350,000"
replace q22_2_text="5500000" if q22_2_text=="same"
replace q22_2_text="0" if q22_1_text=="0" & q22_2_text==""
replace q22_2_text="0" if respondent_id==20174

* Correct profits in a typical month
replace q23_2_text="4000" if q23_2_text=="$4,000"

* Correct household expenditures
replace q29=subinstr(q29,"$","",2)
replace q29=subinstr(q29,",","",2)
replace q29=subinstr(q29,".00","",1)
replace q29=subinstr(q29,"about","",1)

* Correct number of children
replace q44="0" if q44=="n/a" | q44=="none"

* Correct reservation wage
replace q54=subinstr(q54,",","",1)
replace q54=subinstr(q54,".00","",1)
replace q54=subinstr(q54,"$","",1)
replace q54=subinstr(q54,"gross","",1)
replace q54=subinstr(q54,"per month","",1)
replace q54=subinstr(q54,"monthly","",1)
replace q54=subinstr(q54,"JD","",1)
replace q54="40000" if q54=="40 000"
replace q54="50000" if q54=="50"

* Correct number of employees wished to have in 5 years
replace q55="3" if q55=="3  or 4"
replace q55=subinstr(q55,"or more","",1)
replace q55=subinstr(q55, "about", "",1)
replace q55=subinstr(q55,"+","",1)
replace q55="22" if q55=="20-25"
replace q55="5" if q55=="Five"
replace q55="7" if q55=="5-10"
replace q55="6" if q55=="At least 6 persons"

* Correct number of employees expected to have in 5 years
replace q56="3" if q56=="3 or 4"
replace q56=subinstr(q56,"or more","",1)
replace q56=subinstr(q56,"about","",1)
replace q56=subinstr(q56,"+","",1)
replace q56="17" if q56=="15-18"
replace q56="10" if q56=="Ten"
replace q56="7" if q56=="5-10"
replace q56="6" if q56=="5-7"
replace q56=q55 if q56=="Same as above"


*** Update data from control calls ***

* Correct sales in a typical months with data from update calls
replace q21_2_text="" if respondent_id==20051
replace q21_2_text="200000" if respondent_id==20119
replace q21_2_text="40000" if respondent_id==20215
replace q21_2_text="30000" if respondent_id==20264
replace q21_2_text="" if respondent_id==20453
replace q21_2_text="80000" if respondent_id==20657
replace q21_2_text="300000" if respondent_id==20757
replace q21_2_text="50000" if respondent_id==20835

* Correct costs in a typical months with data from update calls
replace q22_2_text="25000" if respondent_id==20080
replace q22_2_text="17000" if respondent_id==20215
replace q22_2_text="20000" if respondent_id==20264
replace q22_2_text="" if respondent_id==20453
replace q22_2_text="" if respondent_id==20668
replace q22_2_text="100000" if respondent_id==20757
replace q22_2_text="20000" if respondent_id==20835
replace q22_2_text="" if respondent_id==20944

* Correct profits in a typical months with data from update calls
replace q23_2_text="0" if respondent_id==20003
replace q23_2_text="10000" if respondent_id==20080
replace q23_2_text="23000" if respondent_id==20215
replace q23_2_text="10000" if respondent_id==20264
replace q23_2_text="" if respondent_id==20453
replace q23_2_text="70000" if respondent_id==20657
replace q23_2_text="200000" if respondent_id==20757
replace q23_2_text="30000" if respondent_id==20835

* Additional corrections to course location
replace q33_1="1" if respondent_id==20023
replace q33_1="0" if respondent_id==20215
replace q33_2="0" if respondent_id==20140

* Additional corrections
replace q43="0" if respondent_id==20453


*** Save dataset ***

* Drop unnecessary variables
drop v2 v4 v7 v10 v155

* Attempt to destring everything possible
destring, replace

* Save dataset for Qualtrics survey
compress
save "$data_int/bas_data_qualtrics_cleaned", replace




********************
*** SurveyMonkey ***
********************

*** Load data ***

* Import data from CSV
use "$data_raw/bas_data_monkey", clear

* Label respondent_id
lab var respondent_id "Respondent ID"

* Use variable name if no variable label available
foreach var of varlist * {
	if "`: var lab `var''"=="" lab var `var' "`var'"
}



*** Edit data ***

* Correct self-employment var for respondents who misinterpreted the question and reported profits and/or sales
replace q6="1" if respondent_id==20013
replace q6="1" if respondent_id==20018
replace q6="1" if respondent_id==20047
replace q6="1" if respondent_id==20056
replace q6="1" if respondent_id==20101
replace q6="1" if respondent_id==20143
replace q6="1" if respondent_id==20165
replace q6="1" if respondent_id==20182
replace q6="1" if respondent_id==20235
replace q6="1" if respondent_id==20249
replace q6="1" if respondent_id==20270
replace q6="1" if respondent_id==20273
replace q6="1" if respondent_id==20306
replace q6="1" if respondent_id==20325
replace q6="1" if respondent_id==20337
replace q6="1" if respondent_id==20347
replace q6="1" if respondent_id==20384
replace q6="1" if respondent_id==20391
replace q6="1" if respondent_id==20403
replace q6="1" if respondent_id==20405
replace q6="1" if respondent_id==20440
replace q6="1" if respondent_id==20454
replace q6="1" if respondent_id==20455
replace q6="1" if respondent_id==20468
replace q6="1" if respondent_id==20508
replace q6="1" if respondent_id==20514
replace q6="1" if respondent_id==20534
replace q6="1" if respondent_id==20557
replace q6="1" if respondent_id==20568
replace q6="1" if respondent_id==20598
replace q6="1" if respondent_id==20599
replace q6="1" if respondent_id==20626
replace q6="1" if respondent_id==20635
replace q6="1" if respondent_id==20636
replace q6="1" if respondent_id==20653
replace q6="1" if respondent_id==20654
replace q6="1" if respondent_id==20656
replace q6="1" if respondent_id==20682
replace q6="1" if respondent_id==20698
replace q6="1" if respondent_id==20709
replace q6="1" if respondent_id==20723
replace q6="1" if respondent_id==20730
replace q6="1" if respondent_id==20737
replace q6="1" if respondent_id==20738
replace q6="1" if respondent_id==20813
replace q6="1" if respondent_id==20814
replace q6="1" if respondent_id==20817
replace q6="1" if respondent_id==20842
replace q6="1" if respondent_id==20848
replace q6="1" if respondent_id==20849
replace q6="1" if respondent_id==20860
replace q6="1" if respondent_id==20906
replace q6="1" if respondent_id==20915

* Correct sales and profits
foreach var of varlist q21_1_text q21_2_text q23_1_text q23_2_text {
	replace `var'=subinstr(`var',"$","",2)
	replace `var'=subinstr(`var',",","",2)
	replace `var'=subinstr(`var',"about","",1)
	replace `var'=subinstr(`var',"J","",1)
	replace `var'=subinstr(`var',"About","",1)
	replace `var'=subinstr(`var',"Approximately","",1)
	replace `var'=subinstr(`var',"Average","",1)
	replace `var'=subinstr(`var',"N/A","0",1)
	replace `var'=subinstr(`var',"N/a","0",1)
	replace `var'=subinstr(`var',"NA","0",1)
	replace `var'=subinstr(`var',"N.A","0",1)
	replace `var'=subinstr(`var',"Na","0",1)
	replace `var'=subinstr(`var',"n/a","0",1)
	replace `var'=subinstr(`var',"mostly breakeven","0",1)
	replace `var'=subinstr(`var',"per month","",1)
	replace `var'=subinstr(`var',".00","",1)
	replace `var'="0" if `var'=="None" | `var'=="no income" | `var'=="J0 Business not yet started"
	replace `var'="0" if `var'=="0 (no confirmed transaction as yet)" | `var'=="Has not yet started trading"
	replace `var'="0" if `var'=="No business in the last year " | `var'=="No sales data currently"
	replace `var'="0" if `var'=="No sales in the last 30 days" | `var'=="No sales in the last 30 days. Crops a.."
	replace `var'="0" if `var'=="No sales now" | `var'=="No sales yet" | `var'=="Not applicable"
	replace `var'="0" if `var'=="Not done much in the last 30 days" | `var'=="Not quantifiable"
	replace `var'="0" if `var'=="We have paused operation to put in pr.." | `var'=="nil" | `var'=="no applicable"
	replace `var'="0" if `var'=="none " | `var'=="none yet" | `var'=="0 Business not yet started" | `var'=="-00000"
	replace `var'="0" if strpos(`var',"No sales")>0
	replace `var'="0" if strpos(`var',"paused")>0
	replace `var'="0" if strpos(`var',"not yet")>0
	replace `var'="0" if strpos(`var',"Not as yet")>0
	replace `var'="0" if strpos(`var',"VERY SLOW")>0
	replace `var'="0" if strpos(`var',"None")>0
	replace `var'="1600000" if `var'=="1.6mil"
	replace `var'="100000" if `var'=="100K"
	replace `var'="20000" if `var'=="15000-25000"
	replace `var'="150000" if `var'=="150k"
	replace `var'="1000000" if `var'=="1M"
	replace `var'="2000000" if `var'=="2 Million "
	replace `var'="3400000" if `var'=="3.4M"
	replace `var'="3800000" if `var'=="3.8M"
	replace `var'="30000" if `var'=="30 000"
	replace `var'="35000" if `var'=="30000-40000"
	replace `var'="300000" if `var'=="300k"
	replace `var'="35000" if `var'=="35"
	replace `var'="6000000" if `var'=="6 million"
	replace `var'="75000" if `var'=="70-80000" | `var'=="70-80,000"
	replace `var'="30000000" if `var'=="over 30 million"
	replace `var'="75000" if `var'=="75000 recently up from 66000"
	replace `var'="150000" if `var'=="1500000."
	replace `var'="350000" if `var'=="200-500k"
	replace `var'="2500000" if `var'=="2.5 millions "	
	replace `var'="4000000" if `var'=="3-5M"
	replace `var'="200000" if `var'=="200k"
	replace `var'="3500000" if `var'=="3.5M"
	replace `var'="325000" if `var'=="300000-350000"
	replace `var'="3500000" if `var'=="3000000 - 4000000"
	replace `var'="425000" if `var'=="350000 - 500000"
	replace `var'="450000" if `var'=="350000 - J550000.00"
	replace `var'="375000" if `var'=="350000-400000"
	replace `var'="50000" if `var'=="40000 to 60000 "
	replace `var'="70000" if `var'=="40000-100000.00"
	replace `var'="82500" if `var'=="45000-120000"
	replace `var'="15000" if `var'=="5000- 25000"
	replace `var'="50000" if `var'=="50000 new business"
	replace `var'="50000" if `var'=="50000."
	replace `var'="650000" if `var'=="500000-800000"
	replace `var'="67500" if `var'=="60-75000"
	replace `var'="150000" if `var'=="60000 to 150000.00 "
	replace `var'="12500" if `var'=="Between  10000 and 15000"
	replace `var'="150000" if `var'=="150000.00 "
	replace `var'="10000" if `var'=="8000-12000 "
	replace `var'="12500" if `var'=="Between  10000 and 15000"
	replace `var'="80000" if `var'=="60000 to 150000.00 "
	replace `var'="-5000" if `var'=="_5000"
	replace `var'="0" if `var'=="break even"
	replace `var'="195000" if `var'=="150000-220000"
	replace `var'="280000" if `var'=="280 000"
	replace `var'="12000" if `var'=="april 12000"
	replace `var'="-5000" if `var'=="_5000"
	replace `var'="0" if `var'=="break even to loss"
}

* Correct household expenditures
replace q29=subinstr(q29,"$","",2)
replace q29=subinstr(q29,",","",2)
replace q29=subinstr(q29,".00","",1)
replace q29=subinstr(q29,"about","",1)
replace q29="120000" if q29=="120 000"
replace q29="130000" if q29=="130 000 00"
replace q29="150000" if q29=="150k"
replace q29="70000" if q29=="70000 JMD"
replace q29="80000" if q29=="80 000"
replace q29="60000" if q29=="$60, 000"
replace q29="60000" if q29=="60 000"
replace q29="17500" if q29=="15000-20000"
replace q29="50000" if q29=="About 50000"

* Correct reservation wage
replace q54=subinstr(q54,",","",1)
replace q54=subinstr(q54,".00","",1)
replace q54=subinstr(q54,"$","",1)
replace q54=subinstr(q54,"gross","",1)
replace q54=subinstr(q54,"per month","",1)
replace q54=subinstr(q54,"monthly","",1)
replace q54=subinstr(q54,"JD","",1)
replace q54="100000" if q54=="100 thousands "
replace q54="1000000" if q54=="1000,000"
replace q54="250000" if q54=="250 000 net"
replace q54="37500" if q54=="35000- 40000"
replace q54="70000" if q54=="70000 after tax"
replace q54="190000" if q54=="180000-200,000"
replace q54="80000" if q54=="80 000"
replace q54="185000" if q54=="185000  nets"
replace q54="40000" if q54=="9000 per week"
replace q54="185000" if q54=="185,000  net monthly"
replace q54="200000" if q54=="200 000"
replace q54="258000" if q54=="2000 usd montly"
replace q54="270000" if q54=="270 000"
replace q54="36000" if q54=="8000 per week "
replace q54="185000" if respondent_id==20814

* Correct number of employees wished to have in 5 years
replace q55="10" if q55=="10 per location"
replace q55="12" if q55=="10-15"
replace q55="17" if q55=="15 - 20"
replace q55="20" if q55=="15-25"
replace q55="22" if q55=="20-25"
replace q55="32" if q55=="30 to 35"
replace q55="40" if q55=="30-50"
replace q55="4" if q55=="4-5"
replace q55="6" if q55=="4-9"
replace q55="5" if q55=="5-6"
replace q55="75" if q55=="50-100"
replace q55="25" if q55=="over 25"
replace q55="10" if q55=="ten"
replace q55="20" if q55=="20 FT"
replace q55="5" if q55=="4-6 or more if needed "
replace q55="6" if q55=="5-10"
replace q55="8" if q55=="6 - 10"
replace q55="25" if q55=="over 25 "
replace q55="8" if q55=="8 plus contracted sales vendors"

* Correct number of employees expected to have in 5 years
replace q56="3" if q56=="3 or 4"
replace q56=subinstr(q56,"or more","",1)
replace q56=subinstr(q56,"about","",1)
replace q56=subinstr(q56,">","",1)
replace q56="12" if q56=="10-15"
replace q56="40" if q56=="30-50"
replace q56="42" if q56=="35-50"
replace q56="7" if q56=="5-10"
replace q56="5" if q56=="5-6"
replace q56="25" if q56=="over 25"
replace q56="10" if q56=="ten"
replace q56="5" if q56=="five"
replace q56="10" if q56=="10 FT"
replace q56="5" if q56=="4-6"
replace q56="6" if q56=="6 plus contracted sales vendors"
replace q56="15" if q56=="20-30"

* Correct sales in the last month
replace q21_1_text="18000" if q21_1_text=="$18.000"
replace q21_1_text="30000" if q21_1_text=="30.000"
replace q21_1_text="70000" if q21_1_text=="$70.000"
replace q21_1_text="264000" if q21_1_text=="264.000"
replace q21_1_text="2800000" if q21_1_text=="$2.8ML"
replace q21_1_text="450000" if q21_1_text=="15000 daily"
replace q21_1_text="762000" if q21_1_text=="?US$6,OOO."
replace q21_1_text="60000" if q21_1_text=="$60,000 monthly income"
replace q21_1_text="60000" if q21_1_text=="60000 monthly income "
replace q21_1_text="4000000" if q21_1_text=="4million"
replace q21_1_text="0" if q21_1_text=="Not yet in complete operation"
replace q21_1_text="0" if q21_1_text=="Not yet in operation" 
replace q21_1_text="0" if q21_1_text=="We will be producing our first batch of poultry meat at the of September 2016"
replace q21_1_text="20000" if q21_1_text=="twenty thousand"
replace q21_1_text="1500000" if q21_1_text=="1.5 million"
replace q21_1_text="1000" if q21_1_text=="1000 sales"
replace q21_1_text="1800000" if q21_1_text=="1.8mil"
replace q21_1_text="2000000" if q21_1_text=="2 million"
replace q21_1_text="140000" if q21_1_text=="140, 000.00"
replace q21_1_text="1500000" if q21_1_text=="$1.5 million"
replace q21_1_text="0" if q21_1_text=="Zero "
replace q21_1_text="0" if q21_1_text=="No operation during that. period"
replace q21_1_text="0" if q21_1_text=="Nil" 
replace q21_1_text="60000" if q21_1_text=="$60,000 monthly income "
replace q21_1_text="3000000" if q21_1_text=="3million"
replace q21_1_text="12000" if q21_1_text=="$12,000jmd"
replace q21_1_text="12000" if q21_1_text=="12000jmd"
replace q21_1_text="" if respondent_id==20810
replace q21_1_text="762000" if respondent_id==20072
replace q21_1_text="" if respondent_id==20307
replace q21_1_text="140000" if respondent_id==20366
replace q21_1_text="" if respondent_id==20507
replace q21_1_text="" if respondent_id==20617
replace q21_1_text="" if respondent_id==20856
replace q21_1_text="30000" if respondent_id==20306
replace q21_1_text="18000" if respondent_id==20417
replace q21_1_text="70000" if respondent_id==20515
replace q21_1_text="60000" if respondent_id==20581
replace q21_1_text="264000" if respondent_id==20761
replace q21_1_text="12000" if respondent_id==20810

* Correct sales in a typical month
replace q21_2_text="1500000" if q21_2_text=="1.5"
replace q21_2_text="25000" if q21_2_text=="250"
replace q21_2_text="31000" if q21_2_text=="310"
replace q21_2_text="264000" if q21_2_text=="264.000"
replace q21_2_text="35000" if q21_2_text=="$35,000.000"
replace q21_2_text="140000" if q21_2_text=="140,000.000"
replace q21_2_text="50000" if q21_2_text=="50,000,00"
replace q21_2_text="5500000" if q21_2_text=="3 to 8 milion"
replace q21_2_text="0" if q21_2_text=="....n/a...." | q21_2_text=="na" | q21_2_text=="Not yet in operation"
replace q21_2_text="60000" if q21_2_text=="$60,000 monthly income "
replace q21_2_text="500000" if q21_2_text=="JMD$ 500000"
replace q21_2_text="1500000" if q21_2_text=="same" & q21_1_text=="1.5 million"
replace q21_2_text="200000" if q21_2_text=="200000up"
replace q21_2_text="0" if q21_2_text=="projected sales $460000"
replace q21_2_text="75000" if q21_2_text=="same as above" & q21_1_text=="75000"
replace q21_2_text="1000000" if q21_2_text=="1mil"
replace q21_2_text="2500000" if q21_2_text=="$2.5 ML"
replace q21_2_text="20000" if q21_2_text=="Sometimes $20,000 or less or more"
replace q21_2_text="420000" if q21_2_text=="420, 000 monthly"
replace q21_2_text="0" if q21_2_text=="projected at $300,000.00 per month in year one"
replace q21_2_text="75000" if q21_2_text=="75000 recently up from 66000"
replace q21_2_text="30000" if q21_2_text=="Thirty thousand (30000) dollars"
replace q21_2_text="300000" if q21_2_text=="Before the break we were bring in between 250,000 and 350,000 with minimal effort."
replace q21_2_text="15000" if q21_2_text=="15,000. Cooking is done for sale at the Fridays only."
replace q21_2_text="20000" if q21_2_text=="twenty thousand"
replace q21_2_text="60000" if q21_2_text=="$60,000 monthly income"
replace q21_2_text="350000" if q21_2_text=="3 months ago. $350,000.00"
replace q21_2_text="350000" if q21_2_text=="3 months ago. $350000"
replace q21_2_text="80000" if q21_2_text=="$60,000.00 to $100,000.00 per month"
replace q21_2_text="1500000" if q21_2_text=="$1.5 million"
replace q21_2_text="15000" if q21_2_text=="$15,000jmd"
replace q21_2_text="3000000" if q21_2_text=="3million"
replace q21_2_text="0" if q21_2_text=="nil" | q21_2_text=="Nil"
replace q21_2_text="0" if q21_1_text=="0" & q21_2_text==""
replace q21_2_text="50000" if respondent_id==20064
replace q21_2_text="11000" if respondent_id==20069
replace q21_2_text="762000" if respondent_id==20072
replace q21_2_text="435000" if respondent_id==20212
replace q21_2_text="350000" if respondent_id==20261
replace q21_2_text="75000" if respondent_id==20262
replace q21_2_text="0" if respondent_id==20293
replace q21_2_text="" if respondent_id==20322
replace q21_2_text="30000" if respondent_id==20382
replace q21_2_text="20000" if respondent_id==20391
replace q21_2_text="0" if respondent_id==20423
replace q21_2_text="0" if respondent_id==20427
replace q21_2_text="0" if respondent_id==20466
replace q21_2_text="70000" if respondent_id==20515
replace q21_2_text="420000" if respondent_id==20617
replace q21_2_text="15000" if respondent_id==20645
replace q21_2_text="0" if respondent_id==20681
replace q21_2_text="80000" if respondent_id==20699
replace q21_2_text="180000" if respondent_id==20709
replace q21_2_text="60000" if respondent_id==20718
replace q21_2_text="0" if respondent_id==20733
replace q21_2_text="15000" if respondent_id==20810
replace q21_2_text="0" if respondent_id==20814
replace q21_2_text="0" if respondent_id==20856

* Correct costs in the last month
replace q22_1_text="120000" if respondent_id==20581

* Correct costs in a typical month
replace q22_2_text="0" if q22_1_text=="0" & q22_2_text==""

* New update on sales
replace q21_2_text="60000" if respondentid=="4962514957"
replace q21_2_text="250000" if respondentid=="4906019192"
replace q21_2_text="15000" if respondentid=="4918639054"
replace q21_2_text="100000" if respondentid=="4894289643"
replace q21_2_text="500000" if respondentid=="4899966883"
replace q21_2_text="50000" if respondentid=="4919396786"

* Correct profits in the last month
replace q23_1_text="0" if q23_1_text=="O"
replace q23_1_text="0" if q23_1_text=="o"
replace q23_1_text="0" if q23_1_text=="Not yet in operation" 
replace q23_1_text="0" if q23_1_text=="no business in the last month"
replace q23_1_text="-150000" if q23_1_text=="- 150000"
replace q23_1_text="15000" if respondent_id==20581

* Correct profits in a typical month
replace q23_2_text="0" if q23_2_text=="0 mostly breakeven"
replace q23_2_text="-200000" if q23_2_text=="- 200000"
replace q23_2_text="280000" if q23_2_text=="280 000"
replace q23_2_text="-20000" if q23_2_text=="- 20000"
replace q23_2_text="190000" if q23_2_text=="18000-20000"
replace q23_2_text="6000" if respondent_id==20069
replace q23_2_text="0" if respondent_id==20210
replace q23_2_text="370000" if respondent_id==20212
replace q23_2_text="63455" if respondent_id==20303
replace q23_2_text="" if respondent_id==20322
replace q23_2_text="" if respondent_id==20408
replace q23_2_text="" if respondent_id==20814


* Correct age
replace q40="1965" if q40=="65"
replace q40="1949" if q40=="2949"
replace q40="1963" if q40=="1863"


*** Update data from control calls ***

* Correct sales in a typical months with data from update calls
replace q21_2_text="30000" if respondent_id==20052
replace q21_2_text="80000" if respondent_id==20102
replace q21_2_text="0" if respondent_id==20123
replace q21_2_text="50000" if respondent_id==20127
replace q21_2_text="36000" if respondent_id==20159
replace q21_2_text="500000" if respondent_id==20185
replace q21_2_text="25000" if respondent_id==20193
replace q21_2_text="50000" if respondent_id==20214
replace q21_2_text="70000" if respondent_id==20226
replace q21_2_text="50000" if respondent_id==20242
replace q21_2_text="60000" if respondent_id==20245
replace q21_2_text="16000" if respondent_id==20253
replace q21_2_text="40000" if respondent_id==20275
replace q21_2_text="12000" if respondent_id==20309
replace q21_2_text="250000" if respondent_id==20310
replace q21_2_text="50000" if respondent_id==20334
replace q21_2_text="130000" if respondent_id==20345
replace q21_2_text="140000" if respondent_id==20366
replace q21_2_text="" if respondent_id==20370
replace q21_2_text="" if respondent_id==20371
replace q21_2_text="240000" if respondent_id==20389
replace q21_2_text="230390" if respondent_id==20408
replace q21_2_text="25000" if respondent_id==20412
replace q21_2_text="40000" if respondent_id==20433
replace q21_2_text="4000" if respondent_id==20437
replace q21_2_text="20000" if respondent_id==20443
replace q21_2_text="170000" if respondent_id==20457
replace q21_2_text="60000" if respondent_id==20477
replace q21_2_text="30000" if respondent_id==20479
replace q21_2_text="100000" if respondent_id==20480
replace q21_2_text="22000" if respondent_id==20490
replace q21_2_text="150000" if respondent_id==20504
replace q21_2_text="0" if respondent_id==20529
replace q21_2_text="480000" if respondent_id==20537
replace q21_2_text="300000" if respondent_id==20538
replace q21_2_text="100000" if respondent_id==20581
replace q21_2_text="" if respondent_id==20646
replace q21_2_text="0" if respondent_id==20659
replace q21_2_text="0" if respondent_id==20664
replace q21_2_text="4000" if respondent_id==20667
replace q21_2_text="14000" if respondent_id==20673
replace q21_2_text="" if respondent_id==20725
replace q21_2_text="50000" if respondent_id==20746
replace q21_2_text="264000" if respondent_id==20761
replace q21_2_text="31000" if respondent_id==20779
replace q21_2_text="30000" if respondent_id==20783
replace q21_2_text="" if respondent_id==20784
replace q21_2_text="" if respondent_id==20788
replace q21_2_text="15000" if respondent_id==20799
replace q21_2_text="300000" if respondent_id==20804
replace q21_2_text="" if respondent_id==20812
replace q21_2_text="" if respondent_id==20813
replace q21_2_text="57600" if respondent_id==20820
replace q21_2_text="85000" if respondent_id==20870
replace q21_2_text="80000" if respondent_id==20895
replace q21_2_text="25000" if respondent_id==20897
replace q21_2_text="100000" if respondent_id==20923
replace q21_2_text="15000" if respondent_id==20924
replace q21_2_text="30000" if respondent_id==20926
replace q21_2_text="" if respondent_id==20931
replace q21_2_text="100000" if respondent_id==20937
replace q21_2_text="80000" if respondent_id==20940

* Correct costs in a typical months with data from update calls
replace q22_2_text="0" if respondent_id==20102
replace q22_2_text="40000" if respondent_id==20127
replace q22_2_text="5000" if respondent_id==20128
replace q22_2_text="26667" if respondent_id==20159
replace q22_2_text="125000" if respondent_id==20185
replace q22_2_text="16000" if respondent_id==20193
replace q22_2_text="25000" if respondent_id==20214
replace q22_2_text="" if respondent_id==20218
replace q22_2_text="7000" if respondent_id==20226
replace q22_2_text="40000" if respondent_id==20245
replace q22_2_text="4000" if respondent_id==20253
replace q22_2_text="15000" if respondent_id==20275
replace q22_2_text="" if respondent_id==20307
replace q22_2_text="3000" if respondent_id==20309
replace q22_2_text="192000" if respondent_id==20310
replace q22_2_text="80000" if respondent_id==20312
replace q22_2_text="20000" if respondent_id==20334
replace q22_2_text="" if respondent_id==20337
replace q22_2_text="20000" if respondent_id==20345
replace q22_2_text="9000" if respondent_id==20389
replace q22_2_text="178231" if respondent_id==20408
replace q22_2_text="83000" if respondent_id==20409
replace q22_2_text="15000" if respondent_id==20412
replace q22_2_text="20000" if respondent_id==20433
replace q22_2_text="10000" if respondent_id==20443
replace q22_2_text="120000" if respondent_id==20457
replace q22_2_text="20000" if respondent_id==20477
replace q22_2_text="50000" if respondent_id==20479
replace q22_2_text="3600" if respondent_id==20480
replace q22_2_text="" if respondent_id==20484
replace q22_2_text="18000" if respondent_id==20490
replace q22_2_text="80000" if respondent_id==20504
replace q22_2_text="" if respondent_id==20508
replace q22_2_text="8000" if respondent_id==20529
replace q22_2_text="90000" if respondent_id==20537
replace q22_2_text="18000" if respondent_id==20538
replace q22_2_text="1200000" if respondent_id==20581
replace q22_2_text="0" if respondent_id==20659
replace q22_2_text="40000" if respondent_id==20664
replace q22_2_text="10000" if respondent_id==20667
replace q22_2_text="" if respondent_id==20673
replace q22_2_text="10000" if respondent_id==20746
replace q22_2_text="20000" if respondent_id==20783
replace q22_2_text="" if respondent_id==20799
replace q22_2_text="25000" if respondent_id==20804
replace q22_2_text="" if respondent_id==20813
replace q22_2_text="15000" if respondent_id==20820
replace q22_2_text="70000" if respondent_id==20870
replace q22_2_text="20000" if respondent_id==20895
replace q22_2_text="51000" if respondent_id==20897
replace q22_2_text="14000" if respondent_id==20923
replace q22_2_text="4000" if respondent_id==20924
replace q22_2_text="15000" if respondent_id==20926
replace q22_2_text="" if respondent_id==20931
replace q22_2_text="5000" if respondent_id==20937
replace q22_2_text="50000" if respondent_id==20940

* Correct profits in a typical months with data from update calls
replace q23_2_text="0" if respondent_id==20102
replace q23_2_text="10000" if respondent_id==20127
replace q23_2_text="200000" if respondent_id==20165
replace q23_2_text="375000" if respondent_id==20185
replace q23_2_text="9000" if respondent_id==20193
replace q23_2_text="25000" if respondent_id==20214
replace q23_2_text="63000" if respondent_id==20226
replace q23_2_text="20000" if respondent_id==20245
replace q23_2_text="12000" if respondent_id==20253
replace q23_2_text="25000" if respondent_id==20275
replace q23_2_text="" if respondent_id==20292
replace q23_2_text="9000" if respondent_id==20309
replace q23_2_text="58000" if respondent_id==20310
replace q23_2_text="20000" if respondent_id==20312
replace q23_2_text="30000" if respondent_id==20334
replace q23_2_text="60000" if respondent_id==20345
replace q23_2_text="231000" if respondent_id==20389
replace q23_2_text="200000" if respondent_id==20400
replace q23_2_text="" if respondent_id==20408
replace q23_2_text="167000" if respondent_id==20409
replace q23_2_text="10000" if respondent_id==20412
replace q23_2_text="20000" if respondent_id==20433
replace q23_2_text="10000" if respondent_id==20443
replace q23_2_text="35000" if respondent_id==20447
replace q23_2_text="50000" if respondent_id==20457
replace q23_2_text="40000" if respondent_id==20477
replace q23_2_text="-20000" if respondent_id==20479
replace q23_2_text="93400" if respondent_id==20480
replace q23_2_text="2000" if respondent_id==20489
replace q23_2_text="4000" if respondent_id==20490
replace q23_2_text="70000" if respondent_id==20504
replace q23_2_text="390000" if respondent_id==20537
replace q23_2_text="282000" if respondent_id==20538
replace q23_2_text="" if respondent_id==20557
replace q23_2_text="30000" if respondent_id==20581
replace q23_2_text="3000" if respondent_id==20667
replace q23_2_text="" if respondent_id==20673
replace q23_2_text="-10000" if respondent_id==20736
replace q23_2_text="25000" if respondent_id==20746
replace q23_2_text="65000" if respondent_id==20761
replace q23_2_text="10000" if respondent_id==20783
replace q23_2_text="" if respondent_id==20799
replace q23_2_text="20000" if respondent_id==20801
replace q23_2_text="275000" if respondent_id==20804
replace q23_2_text="" if respondent_id==20813
replace q23_2_text="" if respondent_id==20814
replace q23_2_text="42600" if respondent_id==20820
replace q23_2_text="15000" if respondent_id==20870
replace q23_2_text="60000" if respondent_id==20895
replace q23_2_text="-26000" if respondent_id==20897
replace q23_2_text="1500" if respondent_id==20924
replace q23_2_text="15000" if respondent_id==20926
replace q23_2_text="" if respondent_id==20931
replace q23_2_text="95000" if respondent_id==20937
replace q23_2_text="" if respondent_id==20938
replace q23_2_text="30000" if respondent_id==20940

* Additional corrections to gender
replace q39="1" if respondent_id==20749

* Additional corrections to course location
replace q33_1="0" if respondent_id==20017
replace q33_1="0" if respondent_id==20022
replace q33_1="0" if respondent_id==20036
replace q33_1="0" if respondent_id==20068
replace q33_1="0" if respondent_id==20188
replace q33_1="0" if respondent_id==20225
replace q33_1="0" if respondent_id==20233
replace q33_1="0" if respondent_id==20304
replace q33_1="0" if respondent_id==20313
replace q33_1="0" if respondent_id==20334
replace q33_1="0" if respondent_id==20388
replace q33_1="0" if respondent_id==20421
replace q33_1="0" if respondent_id==20423
replace q33_1="0" if respondent_id==20440
replace q33_1="0" if respondent_id==20446
replace q33_1="0" if respondent_id==20478
replace q33_1="0" if respondent_id==20485
replace q33_1="0" if respondent_id==20509
replace q33_1="0" if respondent_id==20524
replace q33_1="0" if respondent_id==20587
replace q33_1="0" if respondent_id==20621
replace q33_1="0" if respondent_id==20678
replace q33_1="0" if respondent_id==20691
replace q33_1="0" if respondent_id==20705
replace q33_1="0" if respondent_id==20722
replace q33_1="0" if respondent_id==20727
replace q33_1="0" if respondent_id==20791
replace q33_1="0" if respondent_id==20886
replace q33_1="0" if respondent_id==20903
replace q33_1="0" if respondent_id==20934
replace q33_2="0" if respondent_id==20030
replace q33_2="0" if respondent_id==20054
replace q33_2="0" if respondent_id==20447
replace q33_2="0" if respondent_id==20569
replace q33_2="0" if respondent_id==20692
replace q33_2="0" if respondent_id==20938
replace q33_4="0" if respondent_id==20304
replace q33_4="0" if respondent_id==20503
replace q33_4="0" if respondent_id==20692
replace q33_5="0" if respondent_id==20005
replace q33_5="0" if respondent_id==20054
replace q33_5="0" if respondent_id==20331
replace q33_5="0" if respondent_id==20692



*** Save dataset ***

* Drop unnecessary variables
drop respondentid customdata

* Attempt to destring everything
destring, replace

* Save dataset for MonkeySurvey
compress
save "$data_int/bas_data_monkey_cleaned", replace


